﻿using System;
using System.Windows.Data;
using System.Globalization;

namespace Notoric.Gui.Converters
{
    /// <summary>
    /// Converts a double value in percents into a string with format {value}:F0%.
    /// </summary>
    /// <remarks>
    /// <para>
    /// The format string means a number in a fixed-point format with no decimals 
    /// followed by a percent sign.
    /// </para>
    /// <para>
    /// Conversion from the string back to the percents value is not implemented.
    /// </para>
    /// </remarks>
    [ValueConversion(typeof(double), typeof(string))]
    public class ZoomFormatConverter : IValueConverter
    {

        #region IValueConverter Members

        /// <inheritdoc/>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return String.Format("{0:F0}%", value);
        }

        /// <inheritdoc/>
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
